<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加商品</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <script src="../../layui/js/global.js"></script>
    <script src="../../layui/js/jquery-3.1.1.min.js"></script>
<body>
<div class="layui-container">
    <!-- 上方面包屑导航-->
    <div>
        <span class="layui-breadcrumb">
          <a href="../index.html" target="_top">首页</a>
          <a><cite>商品管理</cite></a>
        </span>
    </div>
    <div id="addDiv">
        <div style="text-align: center">
            <h3 style="margin: 15px">添加商品</h3>
            <form id="addForm" class="layui-form"  lay-filter="addForm">
                <div class="layui-inline">
                    <label class="layui-form-label">商品名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="gamename" required  lay-verify="required" placeholder="请输入商品名称" autocomplete="off" class="layui-input" style="width:200px">
                    </div>
                </div>
                <div  class="layui-inline">
                    <label class="layui-form-label">商品类别</label>
                    <div class="layui-input-inline" >
                        <select  name="typeid" >
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">商品介绍</label>
                    <div class="layui-input-block">
                        <input type="text" name="introduce" required  lay-verify="required" placeholder="请输入商品介绍" autocomplete="off" class="layui-input" style="width:200px">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">商品图片</label>
                    <div class="layui-input-block">
                        <textarea name="photo" id="photo" style="display: none;"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品价格</label>
                    <div class="layui-input-block">
                        <input type="text" name="price" required  lay-verify="required" placeholder="请输入商品价格" autocomplete="off" class="layui-input" style="width:200px">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="button" id="addBtn" class="layui-btn">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>


<script src="../../layui/layui.js"></script>
<script>
    var form;
    var layedit;
    layui.use(['layer','form','layedit'], function(){
        var layer = layui.layer;
        form = layui.form ;
        layedit = layui.layedit ;

        layedit.set({
            uploadImage: {
                url: serverBase + '/sys/game/img'
                ,type: 'POST'
            }
        });
        layedit.build('photo'); //

        initSureBtn(form , layer) ;
    });

    function initSureBtn(form , layer) {
        layedit.sync('photo') ;   // 将富文本编辑器内容同步到表单的多行文本域
        var value =$('#addForm').serialize() ;
    }
</script>
<script src="../../layui/js/sys/addGame.js"></script>

</body>
</html>